package com.lz.behavior.state;

/**
 * ds..
 *
 * @author Lizhong
 * @date 2019/9/26
 */
public class WorkTest {
    public static void main(String[] args) {
        work01();

    }

    private static void work01() {
        AllState allState = new AllState();
        Work02 work = new Work02();
        AllState.ForenoonState forenoonState = allState.new ForenoonState();
        work.setState(forenoonState);
        work.setHour(9);
        work.writeProgram();
        work.setHour(10);
        work.writeProgram();
      // 可以跳跃转换
        work.writeProgram();
        work.setHour(17);
        work.writeProgram();
        // 假设完成工作
        work.setFinish(true);
        work.writeProgram();
        work.setHour(19);
        work.writeProgram();
        work.setHour(22);
        work.writeProgram();
    }

    private static void work() {
        Work work = new Work();
        work.setHour(9);
        work.writeProgram();
        work.setHour(10);
        work.writeProgram();
        work.setHour(12);
        work.writeProgram();
        work.setHour(13);
        work.writeProgram();
        work.setHour(14);
        work.writeProgram();
        work.setHour(17);
        work.writeProgram();
        // 假设完成工作
        work.setFinish(true);
        work.writeProgram();
        work.setHour(19);
        work.writeProgram();
        work.setHour(22);
        work.writeProgram();
    }
}